#ifndef __ARROW_BLOCK_H__
#define __ARROW_BLOCK_H__

#include "Block.hpp"

namespace PocketSurvival
{
	enum class ArrowType
	{
		None,
		WoodenArrow,
		StoneArrow,
		IronArrow,
		DiamondArrow,
		FireArrow,
		IronBolt,
		DiamondBolt,
		ExplosiveBolt,
		CopperArrow
	};

    // 箭
    class ArrowBlock : public Block
    {
    public:
        static constexpr int32_t Index()
        {
            return 192;
        }
        virtual int32_t getIndex() override; 
        virtual const std::string &getBlockName() override;

		virtual float getExplosionPressure(int32_t value) override;
		virtual float getProjectilePower(int32_t value) override;
        virtual void getCreativeValues(std::vector<int32_t> &blockVec) override;

		static inline ArrowType GetArrowType(int32_t data);
		static inline int32_t SetArrowType(int32_t data, ArrowType arrowType);
    };

	inline ArrowType ArrowBlock::GetArrowType(int32_t data)
	{
		return (ArrowType)((data & 0xF) + 1);
	}

	inline int32_t ArrowBlock::SetArrowType(int32_t data, ArrowType arrowType)
	{
		if(arrowType == ArrowType::None)
		{
			arrowType = ArrowType::WoodenArrow;
		}
		return (data & -16) | (((int32_t)arrowType - 1) & 0xF);
	}

} // namespace PocketSurvival


#endif
